<link rel="stylesheet" type="text/css" href="./styles/menu.css">
	<?php
		function dibujarMenu($sitio)
		{
			echo '<table>';
			echo '<td height="150px" width="12%">';
			echo '<img src="./images/emmanuel.jpg" width="auto" height="100%">';
			echo '</td>';
			echo '<td height="150px" width="85%">';
			$con=mysqli_connect("localhost","andy","vinnie97","example");
			// Check connection
			if (mysqli_connect_errno())
			{
			  echo "Failed to connect to MySQL: " . mysqli_connect_error();
			}

			$nivel1 = mysqli_query($con,"SELECT menu_id, texto, link FROM menu WHERE sitios_id = " . $sitio . " AND padre_id = 0 ORDER BY orden asc");

			$nivel2 = mysqli_query($con,"SELECT m.padre_id, m.texto, m.link FROM menu AS m JOIN menu AS p ON p.menu_id = m.padre_id WHERE m.sitios_id = " . $sitio . " AND m.padre_id != 0 ORDER BY p.orden asc, m.orden asc");
			$opc = null;

			echo "<div id='menu'>";
			echo "<ul>";
			while($row = mysqli_fetch_array($nivel1))
			{
				echo "<li class='nivel1'><a href='" . $row['link'] . "' class='nivel1'>" . $row['texto'] . "</a>";
				$menu_id = $row['menu_id'];
				echo "<ul>";
				if (!$opc)
					$opc = mysqli_fetch_array($nivel2);
				while($opc && $opc['padre_id'] == $menu_id)
				{
					echo "<li><a href='" . $opc['link'] . "'>" . $opc['texto'] . "</a></li>";
					$opc = mysqli_fetch_array($nivel2);
				}
				echo "</ul></li>";
			}
			echo "</ul></div>";
			mysqli_close($con);
			echo '</td>';
			echo '</table>';
		}
	?>